//sync同步
//async异步


const fs=require("fs");
const path=require("path");

let filePath=path.join(__dirname,"to.txt")
let fileObj=fs.statSync(filePath)

function createTime(timer){
    let obj=new Date(timer)
    let year=obj.getFullYear();
    let month=obj.getMonth()+1;
    let date=obj.getDate();
    let hour=obj.getHours();
    let min=obj.getMinutes();
    let second=obj.getSeconds();
    return year+"-"+month+"-"+date+" "+hour+":"+min+":"+second
}

console.log("文件大小"+fileObj.size)//以字节为单位
console.log("创建时间"+createTime(fileObj.birthtimeMs))//